<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var removeDuplicates = function(nums) {
        var k = 0;
        for(let i=0;i<nums.length;i++){
            if(nums[k]!=nums[i]){
                nums[++k] = nums[i]
            }
        }
        return k+1;
    };
    var nums = [0,0,1,1,1,2,2,3,3,4];
    console.log(removeDuplicates(nums));

</script>
</body>
</html>